#ifndef _TASK_H_
#define _TASK_H_

#include <memory>
#include <sys/socket.h>
#include <unistd.h>

#include "Logger.h"
#include "request.h"
#include "response.h"
#include "connector.h"
#include "dxyReflectClass.h"
#include "util.h"

namespace dxy::easyWebServer
{

class Task
{
public:
    Task();
    Task(int fd);
    ~Task();

    void run();

private:
    void process();
    void parse(std::string & src, std::string & idx1, std::string & idx2, std::string & parameter);

private:
    int                                 m_fd            = -1;
    std::shared_ptr<Request>            m_request       = nullptr;
    std::shared_ptr<Response>           m_response      = nullptr;
    Connector                           m_conn;
};


}


#endif